package model

type FileMetadata struct {
	Note  *string  `yaml:"note,omitempty"`
	Tags  []string `yaml:"tags,omitempty"`
	Score *int     `yaml:"score,omitempty"`
	Url   *string  `yaml:"url,omitempty"`
}

type FileMetadataMap struct {
	FilenameMap  map[string]*FileMetadata `yaml:"file_metadata,omitempty"`
	MetaFileInfo *FileInfo
}

func (data *FileMetadataMap) SetFileMetadata(fileInfo *FileInfo) {
	if data.FilenameMap == nil {
		data.FilenameMap = make(map[string]*FileMetadata)
	}

	fileInfo.FormatMetadata()

	data.FilenameMap[fileInfo.Name] = fileInfo.Metadata
	if fileInfo.Metadata == nil {
		delete(data.FilenameMap, fileInfo.Name)
		return
	}
}
